package cs348a.io;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.List;

import cs348a.data.Site;

/**
 * Writes site lists to file
 * 
 * @author H.S Kim
 */
public class SiteWriter {

	static public void writeSiteFile(List<Site> siteList, String fileName) {
		File file = new File(fileName);
		Writer output = null;
		
		try {
			output = new BufferedWriter(new FileWriter(file));
			
			for(Site s : siteList) {
			    output.write(new String(s.x+" "+s.y+" "+s.z+"\r\n"));
			}
			
			output.close();
		} catch (IOException e) {
			e.printStackTrace();
		}		
	}
	
}
